// Set all diagonal elements to val
#define N 16
typedef int fix_matrix[N][N];

void fix_set_diag(fix_matrix A, int val) {
  long i;
  for (i = 0; i < N; i++)
    A[i][i] = val;
}

// Set all diagonal elements to val
void fix_set_diag_opt2(fix_matrix A, int val) {
  int *Abase = &A[0][0];
  long i = 0;
  long iend = N * (N + 1);
  do {
    Abase[i] = val;
    i += (N + 1);
  } while (i != iend);
}

/*
gcc -O1 -S s8.fix_set_diag.c
*/